isForwardRangeErrorFormatter

This function produces a descriptive message why R is not a ForwardRange. If R is an ForwardRange the returned string will say so.

@safe pure
string
isForwardRangeErrorFormatter
(
R
)
()

Examples

ditto

struct Foo {}
enum msg = isForwardRangeErrorFormatter!(Foo);
enum exp =`Foo is not an ForwardRange because
the property 'empty' does not exist
and the property 'front' does not exist
and the function 'popFront' does not exist
and the property 'save' does not exist`;
static assert(msg == exp, msg ~ "\n" ~ exp);
string msg2 = isForwardRangeErrorFormatter!(Foo);
assert(msg2 == exp, msg ~ "\n" ~ exp);

ditto

struct Foo {
	int empty;
}
enum msg = isForwardRangeErrorFormatter!(Foo);
enum exp =`Foo is not an ForwardRange because
the property 'empty' is not of type 'bool' but 'int'
and the property 'front' does not exist
and the function 'popFront' does not exist
and the property 'save' does not exist`;
static assert(msg == exp, msg ~ "\n" ~ exp);
string msg2 = isForwardRangeErrorFormatter!(Foo);
assert(msg2 == exp, msg ~ "\n" ~ exp);

ditto

struct Foo {
	bool empty;
	void front();
}
enum msg = isForwardRangeErrorFormatter!(Foo);
enum exp =`Foo is not an ForwardRange because
the property 'front' does not return a non 'void' value
and the function 'popFront' does not exist
and the property 'save' does not exist`;
static assert(msg == exp, msg ~ "\n" ~ exp);
string msg2 = isForwardRangeErrorFormatter!(Foo);
assert(msg2 == exp, msg ~ "\n" ~ exp);

ditto

struct Foo {
	bool empty;
	int front();
}
enum msg = isForwardRangeErrorFormatter!(Foo);
enum exp =`Foo is not an ForwardRange because
the function 'popFront' does not exist
and the property 'save' does not exist`;
static assert(msg == exp, msg ~ "\n" ~ exp);
string msg2 = isForwardRangeErrorFormatter!(Foo);
assert(msg2 == exp, msg ~ "\n" ~ exp);

ditto

struct Foo {
	bool empty;
	int front();
	void popFront();
}
enum msg = isForwardRangeErrorFormatter!(Foo);
enum exp =`Foo is not an ForwardRange because
the property 'save' does not exist`;
static assert(msg == exp, msg ~ "\n" ~ exp);
string msg2 = isForwardRangeErrorFormatter!(Foo);
assert(msg2 == exp, msg ~ "\n" ~ exp);

ditto

struct Foo {
	bool empty;
	int front();
	void popFront();
	int save;
}
enum msg = isForwardRangeErrorFormatter!(Foo);
enum exp =`Foo is not an ForwardRange because
the property 'save' does not return a 'Foo' but a 'int'`;
static assert(msg == exp, msg ~ "\n" ~ exp);
string msg2 = isForwardRangeErrorFormatter!(Foo);
assert(msg2 == exp, msg ~ "\n" ~ exp);

ditto

struct Foo {
	bool empty;
	int front();
	void popFront();
	Foo save() { return this; }
}
enum msg = isForwardRangeErrorFormatter!(Foo);
enum exp =`Foo is an ForwardRange`;
static assert(msg == exp, msg ~ "\n" ~ exp);
string msg2 = isForwardRangeErrorFormatter!(Foo);
assert(msg2 == exp, msg ~ "\n" ~ exp);

Meta